// Robert van Seggelen, robertvs@gmail.com
// 2011
SoundCloud = function(userOptions) {
	//default options
	var options = {
		key: 'c1af380adee9db6a9c1b9bd493d9ba4c',
	}; 
	//merge the default options with the user defined ones
	$.extend(true, options, userOptions);
	
	this.GetTrack = function(scUrl, callback){
		var trackResolvUrl = 'http://api.soundcloud.com/resolve.json?&url='+scUrl+'&client_id='+options.key;
		$.ajax({
			'url': trackResolvUrl,
			'type': "GET",
			'dataType': 'jsonp',
			success: function(urlResult) {
				callback(urlResult);
			},
			error: function(jqXHR, textStatus, errorThrown){
				options.onError(errorThrown);
			}
		});
	}
	return this;
};